﻿@model List<StudentCoursewarePeriodView>
@{
    Student currentStudent = EduWebHelper.GetStudentSession().Student;
    PeriodDetails lastPeriodDetails = ViewBag.lastPeriodDetails;
    string lastLearning = string.Empty;
    if (lastPeriodDetails != null)
    {
        lastLearning = DateTimeHelper.FormatDateHasSecond(lastPeriodDetails.CreateDateTime);
    }
    string learnPeriodString = "0";
    if (ViewBag.learnPeriod > 0)
    {
        learnPeriodString = DateTimeHelper.GetTimeStringHMS(ViewBag.learnPeriod);
    }
    string dayPeriodString = "0";
    if (ViewBag.dayPeriod > 0)
    {
        dayPeriodString = DateTimeHelper.GetTimeStringHMS(ViewBag.dayPeriod);
    }
    string proStr = ViewBag.progress + "%";
    List<DicDetail> dicList = ViewBag.dicList;
}
<nav class="bar bar-tab">
    <a class="tab-item active replace" href="#page-exercise">
        <span class="icon icon-browser"></span>
        <span class="tab-label">在线练习</span>
    </a>
    <a class="tab-item replace" href='#page-home'>
        <span class="icon icon-home"></span>
        <span class="tab-label">我的课程</span>
    </a>
    <a class="tab-item replace" href="#page-settings">
        <span class="icon icon-me"></span>
        <span class="tab-label">个人中心</span>
    </a>
</nav>

<div id="page-exercise" class="page page-exercise">
    <header class="bar bar-nav">
        <h1 class="title">在线练习</h1>
    </header>

    <div class="content">
        <div class="content-block-title">练习</div>

        <div class="list-block media-list">
            <ul>
                @foreach (var item in dicList)
                {
                    <li>
                        <a href="@Url.Action("Index", "SimulatorExercise", new { businessType= item.Value,businessName=item.Name})" class="item-link item-content external">
                            <div class="item-inner">
                                <div class="item-title-row">
                                    <div class="item-title">@item.Value<span>随机练习</span></div>
                                    <div class="item-after"></div>
                                </div>
                            </div>
                        </a>
                    </li>
                }
            </ul>
        </div>

        <div class="content-block-title">考试</div>
        <div class="list-block media-list">
            <ul>
                @*<li>
                        <a href="@Url.Action("Index", "SimulatorExam")" class="item-link item-content external">
                            <div class="item-inner">
                                <div class="item-title-row">
                                    <div class="item-title">模拟考试</div>
                                    <div class="item-after"></div>
                                </div>
                            </div>
                        </a>
                    </li>*@
                @foreach (var item in dicList)
                {
                    <li>
                        <a href="@Url.Action("Index", "SimulatorExam",new { businessType= item.Value,businessName=item.Name })" class="item-link item-content external">
                            <div class="item-inner">
                                <div class="item-title-row">
                                    <div class="item-title">@item.Value<span>模拟考试</span></div>
                                    <div class="item-after"></div>
                                </div>
                            </div>
                        </a>
                    </li>
                }
            </ul>
        </div>

        <div class="content-block-title">收藏</div>
        <div class="list-block media-list">
            <ul>
                <li>
                    <a href="@Url.Action("Index", "ErrorQuestion")" class="item-link item-content external">
                        <div class="item-inner">
                            <div class="item-title-row">
                                <div class="item-title">错题记录</div>
                                <div class="item-after"></div>
                            </div>
                        </div>
                    </a>
                </li>

                <li>
                    <a href="@Url.Action("Index", "FavoriteQuestion")" class="item-link item-content external">
                        <div class="item-inner">
                            <div class="item-title-row">
                                <div class="item-title">题库收藏</div>
                                <div class="item-after"></div>
                            </div>
                        </div>
                    </a>
                </li>
            </ul>
        </div>
    </div>
</div>

<div id="page-home" class="page page-home">
    <header class="bar bar-nav">
        <h1 class="title">@currentStudent.WorkCategoryName<span></span></h1>
    </header>

    <div class="content">
        <div class="card" style="margin: 0">
            <div valign="bottom" style="padding-left:.25rem" class="main-header card-header color-white no-border">
                <strong>@currentStudent.Name，欢迎回来！</strong>
            </div>
            <div class="card-content">
                <div style="margin: .25rem 0 0 0;font-size: 1rem;color: #0894ec;border-bottom: 2px solid #0894ec;">
                    <span style="margin-left:.25rem">我的学习状态</span> <label class="success-label">@currentStudent.StatusName</label>
                </div>
                <div class="card-content-inner">
                    <p>
                        系统规定学时：<label class="primary-label" style="font-size: 14px;">@DateTimeHelper.GetTimeStringHMS(ViewBag.totalPeriod)</label>
                    </p>
                    <p>
                        累计完成学时：<label class="danger-label">@learnPeriodString</label>
                    </p>
                    <p>今日完成学时：@dayPeriodString</p>
                    <p>
                        @if (!string.IsNullOrEmpty(lastLearning))
                        {
                            <span>上次学习时间：</span>@lastLearning
                        }
                    </p>
                     
                    <p>
                        @if (proStr == "100%")
                        {
                            <div class="warn-label" style="width: 100%; padding: 0;">
                                学习进度：@proStr
                            </div>
                        }
                        else
                        {
                            <div class="primary-label" style="width: 100%; padding: 0;">
                                学习进度：@proStr
                                <div style="width: @proStr; padding-left: 6px; float: left;" class="warn-label">
                                    &nbsp;
                                </div>
                            </div>
                        }
                    </p>
                </div>
            </div>
        </div>

        <div style="margin: .75rem 0 0 0; font-size: 1rem; color: #0894ec; border-bottom: 2px solid #0894ec;">
            <span style="margin-left:.25rem">@currentStudent.WorkCategoryName<span>培训课程</span></span>
        </div>
        <div class="list-block media-list" style="margin-top: 0">
            <ul>
                @for (int index = 0; index < Model.Count; index++)
                {
                    var record = Model[index];
                    var imgUrl = $"/www/img/kc/{index+1}.jpg";
                    <li>
                        <a href="@Url.Action("Learning", new {coursewareId = record.CoursewareId})" class="item-link item-content external">
                            <div class="item-media">
                                <img src="@imgUrl" width="80">
                            </div>
                            <div class="item-inner">
                                <div class="item-title-row">
                                    <div class="item-title" style="color: #0894ec; white-space: normal">@record.CoursewareName</div>
                                    <div class="item-after"></div>
                                </div>
                                <div class="item-subtitle">规定学时:@record.CoursewarePeriodName</div>
                                <div class="item-text">
                                    <span>已学学时: </span>@record.LearnPeriodName
                                </div>
                            </div>
                        </a>
                    </li>
                }
            </ul>
        </div>
    </div>
</div>


<div id="page-settings" class="page page-settings">
    <header class="bar bar-nav">
        <h1 class="title">个人中心</h1>
    </header>

    <div class="content">
        <div class="page-settings">
            @*<div class="list-block media-list person-card">
                    <ul>
                        <li>
                            <div href="#" class="item-content">
                                <div class="item-media">
                                    <i class="icon icon-me" style="font-size:1rem"></i> @currentStudent.Name
                                </div>
                                <div class="item-inner">
                                    <div class="item-title-row">
                                        <div class="item-title"></div>
                                    </div>
                                    <div class="item-subtitle"></div>
                                </div>
                            </div>
                        </li>
                    </ul>
                </div>*@

            <div class="list-block media-list">
                <ul>

                    <li>
                        <a href="@Url.Action("StudentInfo", "Student")" class="item-link item-content">
                            <div class="item-inner">
                                <div class="item-title-row">
                                    <div class="item-title">我的资料</div>
                                    <div class="item-after"></div>
                                </div>
                            </div>
                        </a>
                    </li>

                    <li>
                        <a href="@Url.Action("PeriodDetails", "Student")" class="item-link item-content external">
                            <div class="item-inner">
                                <div class="item-title-row">
                                    <div class="item-title">学时明细</div>
                                    <div class="item-after"></div>
                                </div>
                            </div>
                        </a>
                    </li>

                    <li>
                        <a href="@Url.Action("LearnHistory", "Student")" class="item-link item-content external">
                            <div class="item-inner">
                                <div class="item-title-row">
                                    <div class="item-title">验证记录</div>
                                    <div class="item-after"></div>
                                </div>
                            </div>
                        </a>
                    </li>

                    <li>
                        <a href="@Url.Action("StudentAudits", "Student")" class="item-link item-content external">
                            <div class="item-inner">
                                <div class="item-title-row">
                                    <div class="item-title">登录日志</div>
                                    <div class="item-after"></div>
                                </div>
                            </div>
                        </a>
                    </li>

                    <li>
                        <a href="@Url.Action("Notice", "Student")" class="item-link item-content external">
                            <div class="item-inner">
                                <div class="item-title-row">
                                    <div class="item-title">通知公告</div>
                                    <div class="item-after"></div>
                                </div>
                            </div>
                        </a>
                    </li>

                    <li>
                        <a href="@Url.Action("TrainHistory", "Student")" class="item-link item-content">
                            <div class="item-inner">
                                <div class="item-title-row">
                                    <div class="item-title">培训历史</div>
                                    <div class="item-after"></div>
                                </div>
                            </div>
                        </a>
                    </li>
                    @*<li>
                        <a href="@Url.Action("ExamRecord", "Student")" class="item-link item-content">
                            <div class="item-inner">
                                <div class="item-title-row">
                                    <div class="item-title">成绩查询</div>
                                    <div class="item-after"></div>
                                </div>
                            </div>
                        </a>
                    </li>*@

                </ul>
            </div>
            <div class="content-block">
                <a href="@Url.Action("Logout","Default")" class="button button-big button-fill button-danger external">注销</a>
            </div>
        </div>
    </div>
</div>

@section css{
    <style>
        .main-header {
            background: url(/www/img/mainbg.jpg) no-repeat;
            -ms-background-size: cover;
            background-size: cover;
            color: white;
        }

        .danger-label {
            background-color: #f6383a;
            color: rgb(255, 255, 255);
            font-family: 微软雅黑;
            padding: 0px 6px;
            border-radius: 3px;
        }

        .primary-label {
            background-color: #0894ec;
            color: rgb(255, 255, 255);
            font-family: 微软雅黑;
            padding: 0px 6px;
            border-radius: 3px;
        }

        .success-label {
            background-color: #4cd964;
            color: rgb(255, 255, 255);
            font-family: 微软雅黑;
            padding: 0px 6px;
            border-radius: 3px;
        }

        .gray-label {
            background-color: #eee;
            color: rgb(255, 255, 255);
            font-family: 微软雅黑;
            padding: 0px 6px;
            border-radius: 3px;
        }

        .warn-label {
            background-color: #f60;
            color: rgb(255, 255, 255);
            font-family: 微软雅黑;
            padding: 0px 6px;
            border-radius: 3px;
        }


        .page-settings .person-card {
            margin: .6rem 0;
        }

        .page-settings .row {
            border: 1px solid #ccc;
            background: white;
            border-left: 0;
            border-right: 0;
        }

            .page-settings .row h4 {
                margin: 0.3rem 0;
            }

            .page-settings .row .color-gray {
                margin: 0.3rem 0;
                font-size: 0.7rem;
            }

        .page-settings .col-25 + .col-25 {
            border-left: 1px solid #ccc;
        }

        .page-settings .person-card img {
            border-radius: 100%;
        }

        .page-settings .person-card ul {
            background: transparent;
        }

        .page-settings .person-card .item-text {
            height: auto;
        }

        .page-settings .person-card ul:before,
        .page-settings .person-card ul:after {
            display: none;
        }

        .page-settings .list .icon {
            font-size: 1rem;
        }
    </style>
}